package com.juku2024.juku.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.juku2024.juku.R
import com.juku2024.juku.model.MeListModel
import java.util.*

class SettingAdapter(data: ArrayList<MeListModel>) :
    BaseQuickAdapter<MeListModel, BaseViewHolder>(R.layout.item_setting_list, data) {

    override fun convert(holder: BaseViewHolder, item: MeListModel) {
        holder.setText(R.id.tvSetting, item.name)
            .setText(R.id.tvSettingContent, item.content)
        if (holder.layoutPosition == 0) {
            val bgRes: Int
            if (item.content?.startsWith("更新") == true) {
                bgRes = R.drawable.shape_hot_search_tag
            } else {
                bgRes = R.drawable.shape_me_need_upgrade
            }
            holder.setBackgroundResource(R.id.tvSettingContent, bgRes)
            holder.setTextColorRes(R.id.tvSettingContent, R.color.cf1f1f1)
        }
        val isGone = holder.layoutPosition == 3 || holder.layoutPosition == 2
        holder.setGone(R.id.viewTip, !isGone)
    }

}